/**
 * 
 * gislin
 * 2017年4月26日
 */
package com.hrt.datasender.web.monitordata;

import java.util.Date;
import java.util.HashMap;
import java.util.List;

import com.btcode.db.conver.DefaultValueConver;
import com.btcode.db.conver.IValueConver;
import com.btcode.db.result.Row;

/**
 * @author gislin 2017年4月26日
 */
public class MonitorDataModel {

    /**
     * 报表数据
     */
    List<Row> data;

    /**
     * 涉及到的污染物信息
     */
    List<PollutantsModel> pollInfoList;

    HashMap<String, PollutantsModel> pollInfo;

    String[] parms;

    /**
     * 最小值
     */
    Row minData;
    /**
     * 最大值
     */
    Row maxData;
    /**
     * 平均值
     */
    Row avgData;
    /**
     * 综合水质类别
     */
    Row totalWaterStandard;
    /**
     * 水质类别
     */
    Row waterStandard;
    /**
     * 主要污染物
     */
    Row mainPoll;
    /**
     * 排放量
     */
    Row emissionsData;

    public List<PollutantsModel> getPollInfoList() {
        return pollInfoList;
    }

    public void setPollInfoList(List<PollutantsModel> pollInfoList) {

        pollInfo = new HashMap<>();

        for (PollutantsModel pollModel : pollInfoList) {
            pollInfo.put(pollModel.getPollCode(), pollModel);
        }

        this.pollInfoList = pollInfoList;
    }

    public String[] getParms() {
        return parms;
    }

    public HashMap<String, PollutantsModel> getPollInfo() {
        return pollInfo;
    }

    public void setParms(String[] parms) {
        this.parms = parms;
    }

    public List<Row> getData() {
        return data;
    }

    public void setData(List<Row> data) {

        if (data == null) {
            return;
        }

        IValueConver valueConver = new DefaultValueConver();

        for (Row row : data) {
            try {
                long time = (long) row.get("DATATIME");
                Date datatime = valueConver.converToDate(time);
                row.put("DATATIME", datatime);
            } 
            catch (Exception e) {
            }
        }

        this.data = data;
    }

    public Row getMinData() {
        return minData;
    }

    public void setMinData(Row minData) {
        this.minData = minData;
    }

    public Row getMaxData() {
        return maxData;
    }

    public void setMaxData(Row maxData) {
        this.maxData = maxData;
    }

    public Row getAvgData() {
        return avgData;
    }

    public void setAvgData(Row avgData) {
        this.avgData = avgData;
    }

    public Row getTotalWaterStandard() {
        return totalWaterStandard;
    }

    public void setTotalWaterStandard(Row totalWaterStandard) {
        this.totalWaterStandard = totalWaterStandard;
    }

    public Row getWaterStandard() {
        return waterStandard;
    }

    public void setWaterStandard(Row waterStandard) {
        this.waterStandard = waterStandard;
    }

    public Row getMainPoll() {
        return mainPoll;
    }

    public void setMainPoll(Row mainPoll) {
        this.mainPoll = mainPoll;
    }

    public Row getEmissionsData() {
        return emissionsData;
    }

    public void setEmissionsData(Row emissionsData) {
        this.emissionsData = emissionsData;
    }
}
